
<template>
	<div class="index">

		<div class="center">
			<left></left>
			<div class="right">
          <top></top>
          <div class="hei10"></div>
          <div class="where" style="background: #fff; padding: 10px 30px; font-size: 14px; color: #595959;">当前位置：分销后台><router-link to="/finance/fiancelist">佣金发放</router-link>><router-link to="/finance/fiancedown">确认表下载</router-link></div>
          <div class="hei10"></div>
          
        <div style="height: 16px; width: 100%; background: #EFEFEF;"></div>
				<div class="con" v-loading="loading">

					<div class="list">
                <div class="th">操作人</div>
                <div class="th">时间</div>
                <div class="th">操作</div>
					</div>
					<div class="list" v-for="item in list" :key="item.id">
              <div class="td">{{item.user_name}}</div>
              <div class="td">{{item.created_at}}</div>
              <div class="td">
                <el-button type="text" @click="down(item.local_filename)">下载</el-button>
              </div>
					</div>

					<el-pagination background layout="total,prev, pager, next" :current-page="page" @current-change="fanye" :page-size="pagesize" :total="total"></el-pagination>
				</div>
			</div>
		</div>
		<foot></foot>

	</div>
</template>

<script>
	import axios from 'axios'
	import top from '@/components/top.vue'
	import left from '@/components/left.vue'
	import foot from '@/components/foot.vue'
	export default{
		components: {
			"left": left,
			"top": top,
			"foot": foot
		},
		name: 'fiancedown',
		data(){
			return{
				loading:true,
				total:0,
				pagesize:20,
				page:1,
				list:"",
        leader:""
			}
		},
		created() {
      var that = this

      this.url = window.location.origin+"/"
      //权限问题
      var user = JSON.parse(localStorage.getItem('USER'));
      this.user_func = user.functions
      for( var i in this.user_func){
          var func_number = this.user_func[i].code
          if(func_number.indexOf("J03") >= 0){ this.leader = 1 }
      }
			this.getlist();

		},
		methods:{




      //下载
      down:function(e){
          const a = document.createElement('a');
          a.setAttribute('href', this.url+e);
          a.click();
      },



			//获取分销商
			getlist:function(){
        this.danxuans = [];
        this.quanxuana = false
				var that = this;
				axios.get('/api/plan-market/expend/zip/logs?page=1&page_size=10000&is_leader='+this.leader)
					.then(response => {
						if(response.data.msg.code == 0){
							that.list = response.data.data.data
							that.total = response.data.data.total
							that.loading = false
						}else{
							if(response.data.msg.code == 50401){that.$router.push({ path: "/login" }); return false}
							that.$message.error(response.data.msg.info);
						}
					})
			},



		}

	}
</script>

<style lang="scss" scoped>
	.index{
    .listk{
      .el-radio{ margin:10px;}
    }
		
        .powertop{ display: flex; background:#f9f9f9; }
        .powertopli{ flex-basis: 160px; line-height: 45px; border-top: 4px #EBECEF solid; color: #727272; border-right: 1px #EAEAEA solid; font-size: 14px; text-align: center;}
        .powertopact{ background: #FFFFFF; border-top: 4px #DD2727 solid;}
        .con{  background: #FFFFFF; box-sizing: border-box; padding: 20px 0;}

        .month{ text-align: right;  background: #FFFFFF; padding: 20px;}
				.title{border-bottom: 1px #EAEAEA solid;  line-height: 45px; padding-left: 30px; font-size: 16px; background: #F9F9F9; color: #727272;}
				.add{ display: flex; justify-content: space-between; padding: 20px 30px; text-align: right; position: relative;
					.input-with-select{ width: 280px;}
					.el-button{  padding: 10px 20px;}
				}
        .el-input__icon{line-height: 36px;}
				.list{
					display: flex; text-align: center; color: #727272; line-height: 45px; margin: 0 20px; border: 1px #EAEAEA solid; margin-top: -1px;
					.th{ flex: 1; background: #F9F9F9; font-size: 14px; border-right:1px #EAEAEA solid;  }
					.td{ flex: 1; font-size: 14px; border-right:1px #EAEAEA solid;
						.el-button{
							a{ color: #409EFF;}
							&:hover{
								a{ color: #FFF;}
							}
						}

					}
          .th1{ flex-basis: 50px; background: #F9F9F9; font-size: 14px; border-right:1px #EAEAEA solid;  }
          .td1{ flex-basis: 50px;  font-size: 14px; border-right:1px #EAEAEA solid;  }

				}
				.el-pagination{ text-align: right; margin: 20px 0}
				.my{
					display: flex; justify-content: space-between; padding: 20px; line-height: 20px;
					.myid{
						font-size: 17px; color: #DD2727; padding-left: 10px;
						span{ color: #B1B1B1; font-size: 14px; margin-left: 20px}
					}
					.invitation{
						font-size: 14px; color: #B1B1B1;
						span{ color: #197CFF; cursor: pointer;}
					}
				}


		
	}
</style>
